cmake_minimum_required(VERSION 2.8)

project(libeasysqlite)

#set(SOURCES easysqlite.cpp file.cpp)
aux_source_directory(. SOURCES)

if(NOT MSVC)
    link_libraries(-ldl -pthread)
endif()

set(HEADERS
    SqlCommon.h
    SqlDatabase.h
    SqlField.h
    SqlFieldSet.h
    sqlite3.h
    SqlRecord.h
    SqlRecordSet.h
    SqlTable.h
    SqlValue.h
    )

if(MSVC)
    add_definitions(-DEASYSQLITE_EXPORTS)
endif()

if(BUILD_SHARED_LIBS)
    add_library(easysqlite SHARED ${SOURCES} ${HEADERS})
    install(TARGETS easysqlite DESTINATION lib)
endif()

if(BUILD_STATIC_LIBS)
    add_library(easysqlite_static STATIC ${SOURCES} ${HEADERS})
    set_target_properties(easysqlite_static PROPERTIES OUTPUT_NAME "easysqlite")
    install(TARGETS easysqlite_static DESTINATION lib)
endif()

install(FILES ${HEADERS} DESTINATION include/easySQLite)
